useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.5.0_11'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'Ams_LocDownload_20041228.bin')
##		commonBits.setRecordLayout(select, 'ams Store')
		click('Edit1')
		click('Filter')
		click('Filter1')
		select('Table', 'cell:4|Loc_Name,1(VIC West Ad Support)')
		assert_p('Table', 'Text', 'VIC West Ad Support', '4|Loc_Name,1')
		select('Table', 'cell:4|Loc_Name,1(VIC West Ad Support)')
		select_menu('Data>>Sort')
#		select('Table1', 'cell:4|Loc_Name,1(VIC West Ad Support)')
		##select('List', 'Locations')
		select('Table', 'cell:Field,0( )')
		click('ScrollPane$ScrollBar', 9, 108)
		select('Table', 'Loc_State', 'Field,0')
		select('Table', 'Loc_Nbr', 'Field,1')
		select('Table', 'cell:Field,1(Loc_Nbr)')
		click('Sort1')
		select('Table', 'cell:4|Loc_Name,0(National Ad Support)')
		assert_p('Table', 'Text', 'cell:4|Loc_Name,0(National Ad Support)')
		select('Table', 'cell:4|Loc_Name,12(Canberra Civic)')
		assert_p('Table', 'Text', 'cell:4|Loc_Name,12(Canberra Civic)')
		select('Table', 'cell:4|Loc_Name,12(Canberra Civic)')
		rightclick('Table', '4|Loc_Name,12')
		select_menu('Edit Record')
		select('Table', 'cell:Data,2(ST)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5096, 5096], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Canberra Civic, Canberra Civic], [Loc_Addr_Ln1, 5, , Target Canberra, Target Canberra], [Loc_Addr_Ln2, 6, , Canberra City Centre, Akuna Ave, Canberra City Centre, Akuna Ave], [Loc_Addr_Ln3, 7, , Canberra, Canberra], [Loc_Postcode, 8, , 2601, 2601], [Loc_State, 9, , ACT, ACT], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,2(ST)')
		click('Right')
		select('Table', 'cell:Data,4(Coffs Harbour)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5002, 5002], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Coffs Harbour, Coffs Harbour], [Loc_Addr_Ln1, 5, , Coffs Harbour, Coffs Harbour], [Loc_Addr_Ln2, 6, , Cnr. Park Beach Road & Pacific Hwy, Cnr. Park Beach Road & Pacific Hwy], [Loc_Addr_Ln3, 7, , Coffs Harbour, Coffs Harbour], [Loc_Postcode, 8, , 2450, 2450], [Loc_State, 9, , NSW, NSW], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,4(Coffs Harbour)')
		click('Right')
		select('Table', 'cell:Data,4(Albury)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5005, 5005], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Albury, Albury], [Loc_Addr_Ln1, 5, , Albury, Albury], [Loc_Addr_Ln2, 6, , Kiewa Street, Kiewa Street], [Loc_Addr_Ln3, 7, , Albury, Albury], [Loc_Postcode, 8, , 2640, 2640], [Loc_State, 9, , NSW, NSW], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,4(Albury)')
		click('RightM')
		select('Table', 'cell:Data,5(Cnr Nicholson & Bannister Rd\'s)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5965, 5965], [Loc_Type, 3, , DC, DC], [Loc_Name, 4, , Canning Vale DC, Canning Vale DC], [Loc_Addr_Ln1, 5, , Canning Vale DC, Canning Vale DC], [Loc_Addr_Ln2, 6, , Cnr Nicholson & Bannister Rd\'s, Cnr Nicholson & Bannister Rd\'s], [Loc_Addr_Ln3, 7, , Canning Vale, Canning Vale], [Loc_Postcode, 8, , 6155, 6155], [Loc_State, 9, , WA, WA], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,5(Cnr Nicholson & Bannister Rd\'s)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('Table', 'cell:4|Loc_Name,12(Canberra Civic)')
		rightclick('Table', '4|Loc_Name,4')
		select_menu('Sort')
		##select('List', 'Locations')
		select('Table', 'Loc_Type', 'Field,0')
		select('Table', 'Loc_Nbr', 'Field,1')
		select('Table', 'cell:Field,1(Loc_Nbr)')

		click('Sort1')

		select('Table', 'cell:4|Loc_Name,0(National Ad Support)')
		assert_p('Table', 'Text', 'National Ad Support', '4|Loc_Name,0')
		select('Table', 'cell:4|Loc_Name,0(National Ad Support)')
		rightclick('Table', '4|Loc_Name,0')
		select_menu('Edit Record')
##		select('Table1', 'cell:4|Loc_Name,0(National Ad Support)')
		select('Table', 'cell:Data,3(National Ad Support)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5109, 5109], [Loc_Type, 3, , DC, DC], [Loc_Name, 4, , National Ad Support, National Ad Support], [Loc_Addr_Ln1, 5, , , ], [Loc_Addr_Ln2, 6, , , ], [Loc_Addr_Ln3, 7, , , ], [Loc_Postcode, 8, , , ], [Loc_State, 9, , , ], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,3(National Ad Support)')
		click('Right')
		select('Table', 'cell:Data,3(Head Office)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5700, 5700], [Loc_Type, 3, , DC, DC], [Loc_Name, 4, , Head Office, Head Office], [Loc_Addr_Ln1, 5, , , ], [Loc_Addr_Ln2, 6, , , ], [Loc_Addr_Ln3, 7, , , ], [Loc_Postcode, 8, , , ], [Loc_State, 9, , , ], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,3(Head Office)')
		click('Right')
		select('Table', 'cell:Data,5(30-68 Taras Ave)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5839, 5839], [Loc_Type, 3, , DC, DC], [Loc_Name, 4, , DC - Taras Ave, DC - Taras Ave], [Loc_Addr_Ln1, 5, , , ], [Loc_Addr_Ln2, 6, , 30-68 Taras Ave, 30-68 Taras Ave], [Loc_Addr_Ln3, 7, , Altona North, Altona North], [Loc_Postcode, 8, , 3025, 3025], [Loc_State, 9, , VIC, VIC], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,5(30-68 Taras Ave)')
		click('Right')
		click('Right')
		click('Right')
		click('Right')
		click('Right')
		click('Right')
		click('Right')
		select('Table', 'cell:Data,4(No 2 Sydney Gate)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5897, 5897], [Loc_Type, 3, , DC, DC], [Loc_Name, 4, , Sydney Gate DC, Sydney Gate DC], [Loc_Addr_Ln1, 5, , No 2 Sydney Gate, No 2 Sydney Gate], [Loc_Addr_Ln2, 6, , 830 Bourke Street, 830 Bourke Street], [Loc_Addr_Ln3, 7, , Waterloo, Waterloo], [Loc_Postcode, 8, , 2017, 2017], [Loc_State, 9, , NSW, NSW], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,4(No 2 Sydney Gate)')
		click('RightM')
		select('Table', 'cell:Data,5(Cnr Grove Way & Golden Grove)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5305, 5305], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Golden Grove, Golden Grove], [Loc_Addr_Ln1, 5, , The Golden Way, The Golden Way], [Loc_Addr_Ln2, 6, , Cnr Grove Way & Golden Grove, Cnr Grove Way & Golden Grove], [Loc_Addr_Ln3, 7, , Golden Grove, Golden Grove], [Loc_Postcode, 8, , 5125, 5125], [Loc_State, 9, , SOU, SOU], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,5(Cnr Grove Way & Golden Grove)')
		click('Left')
		select('Table', 'cell:Data,5(2-50 Murray Road)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5304, 5304], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Northland Baby Target, Northland Baby Target], [Loc_Addr_Ln1, 5, , Northland Shopping Centre, Northland Shopping Centre], [Loc_Addr_Ln2, 6, , 2-50 Murray Road, 2-50 Murray Road], [Loc_Addr_Ln3, 7, , East  Preston, East  Preston], [Loc_Postcode, 8, , 3072, 3072], [Loc_State, 9, , VIC, VIC], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,5(2-50 Murray Road)')
		click('Left')
		select('Table', 'cell:Data,5(Gilchrist Drive)')
		assert_p('Table', 'Text', 'Gilchrist Drive', 'Data,5')
		select('Table', 'cell:Data,5(Gilchrist Drive)')
		assert_p('Table', 'Content', '[[Brand_Id, 1, , TAR, TAR], [Loc_Nbr, 2, , 5303, 5303], [Loc_Type, 3, , ST, ST], [Loc_Name, 4, , Macarthur Square, Macarthur Square], [Loc_Addr_Ln1, 5, , Macarthur Square, Macarthur Square], [Loc_Addr_Ln2, 6, , Gilchrist Drive, Gilchrist Drive], [Loc_Addr_Ln3, 7, , Campbelltown, Campbelltown], [Loc_Postcode, 8, , 2560, 2560], [Loc_State, 9, , NSW, NSW], [Loc_Actv_Ind, 10, , A, A]]')
		select('Table', 'cell:Data,5(Gilchrist Drive)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
	close()
